# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gedit
pkgver=44.2
pkgrel=2
pkgdesc="GNOME Text Editor"
url="https://wiki.gnome.org/Apps/Gedit"
arch=(loong64 x86_64)
license=(GPL)
depends=(
  amtk
  gsettings-desktop-schemas
  gspell
  libpeas
  python-gobject
  tepl
)
makedepends=(
  appstream-glib
  desktop-file-utils
  git
  gobject-introspection
  gtk-doc
  meson
  vala
  yelp-tools
)
optdepends=('gedit-plugins: Additional features')
conflicts=('gedit-code-assistance<=3.16.0+4+gd19b879-1')
groups=(gnome-extra)
_commit=394f425d769fce24810fb7dd59107a9ee8616d55  # tags/44.2^0
source=(
  "git+https://gitlab.gnome.org/GNOME/gedit.git#commit=$_commit"
  "git+https://gitlab.gnome.org/GNOME/libgd.git"
)
b2sums=('SKIP'
        'SKIP')

pkgver() {
  cd gedit
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd gedit

  git submodule init
  git submodule set-url subprojects/libgd "$srcdir/libgd"
  git -c protocol.file.allow=always submodule update
}

build() {
  local meson_options=(
    -D gtk_doc=true
    -D require_all_tests=true
  )

  arch-meson gedit build "${meson_options[@]}"
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
